from typing import *
from leetcode.editor.common.node import *


# leetcode submit region begin(Prohibit modification and deletion)
class NumArray(object):

    def __init__(self, nums):
        self.preNums = [0]*(len(nums)+1)
        for i in range(1, len(self.preNums)):
            self.preNums[i] = self.preNums[i-1] + nums[i-1]
        

    def sumRange(self, left, right):
        return self.preNums[right+1] - self.preNums[left]
        


# Your NumArray object will be instantiated and called as such:
# obj = NumArray(nums)
# param_1 = obj.sumRange(left,right)
# leetcode submit region end(Prohibit modification and deletion)


# if __name__ == '__main__':
    # solution = Solution()
    # your test code here